package cu.ds.logicalsync.fytasrealm.communication.event;

import java.util.EventListener;


/**
 *  The listener interface for receiving {@link PeerStatusEvent}s from the
 *  PeerStatus Service.
 *
 *  The following 2 examples illustrate how to implement a 
 *  <code>PeerStatusListener</code>:
 *
 * <p/><b>Example 1:</b>
 * <pre>
 * PeerStatusListener myListener = new PeerStatusListener() {
 *   public void newPeerConnected(PeerStatusEvent e) {
 *     PeerInfo peerInfo = e.getPeerInfo();
 *     String warriorName = peerInfo.getName();
 *     // hooking with application logic when new peer found
 *     // i.e. update map
 *   }
 * }
 * peerStatusService.addListener(myListener);
 * </pre>
 *
 * <p/><b>Example 2:</b>
 * <pre>
 * public class FytaRealmDesktop implements PeerStatusListener {
 *          ..
 *          ..
 *  public void newPeerConnected(PeerStatusEvent e) {
 *     PeerInfo peerInfo = e.getPeerInfo();
 *     String warriorName = peerInfo.getName();
 *     // hooking with application logic when new peer found
 *     // i.e. update map
 *   }
 * }
 * </pre>
 * 
 * @author r.vashira
 * 
 * @see cu.ds.logicalsync.fytasrealm.communication.PeerStatusService
 * @see cu.ds.logicalsync.fytasrealm.communication.event.PeerStatusEvent
 */
public interface PeerStatusListener extends EventListener{
	
	/**
	 * Called to handle an newPeerConnected event from the Discovery Service.
	 * 
	 * @param event the peer status event
	 */
	public void newPeerConnected(PeerStatusEvent event);
}
